import { pget, ppostJson, postFileByFormData } from '@/utils/req';
import { modalApi } from '@/utils/modalReq';

/** 获取物料档案列表 */
export function getWarehousegoodsarchivesList(query?: any) {
  return pget(`${modalApi.storage}/warehousegoodsarchives/list`, query);
}

/** 新增物料档案 */
export function addWarehousegoodsarchives(data: any) {
  return ppostJson(`${modalApi.storage}/warehousegoodsarchives/save`, data);
}

/** 修改物料档案 */
export function editWarehousegoodsarchives(data: any) {
  return ppostJson(`${modalApi.storage}/warehousegoodsarchives/update`, data);
}

/** 查看物料档案详情 */
export function warehousegoodsarchivesInfo(id: string) {
  return pget(`${modalApi.storage}/warehousegoodsarchives/detail/${id}`);
}

/** 删除物料档案 */
export function deleteWarehousegoodsarchives(id: string) {
  return ppostJson(`${modalApi.storage}/warehousegoodsarchives/remove/${id}`);
}

/** 获取导入失败列表 */
export function getErrorExcelList(query: any) {
  return pget(
    `${modalApi.storage}/assetsaccidentdataprocessing/goodsArchivesPage`, query
  );
}

/** 保存物料导入数据 */
export function goodAccountImport(query?: any) {
  return postFileByFormData(
    `${modalApi.storage}/warehousegoodsarchives/goodAccountImport`,
    query,
  );
}
